/*======== CSS Variables ========*/
.theme-dark {
  --toast-background: #2f3136;
  --toast-header: #202225;
  --toast-contents: #36393f;
  --toast-box-shadow: rgba(0, 0, 0, .2);
  --toast-border: rgba(28, 36, 43, .6);
}

.theme-light {
  --toast-background: #fff;
  --toast-header: #e3e5e8;
  --toast-contents: #f2f3f5;
  --toast-box-shadow: rgba(0, 0, 0, .1);
  --toast-border: rgba(28, 36, 43, .06);
}

/*======== Toast Styling ========*/
.powercord-toasts-container {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: flex-end;
}

.powercord-toast {
  display: flex;
  flex-direction: column;
  background-color: var(--toast-background);
  border: 1px solid var(--toast-border);
  box-shadow: 0 2px 10px 0 var(--toast-box-shadow);
  box-sizing: border-box;
  border-radius: 5px;
  position: absolute;
  animation: slide-in .5s ease, shake 1.4s cubic-bezier(.36, .07, .19, .97) both;
  max-width: 600px;
  min-width: 223px;
  width: 320px;
  right: 25px;
  bottom: 25px;
  z-index: 999;

  .header {
    display: flex;
    color: var(--text-normal);
    font-weight: 600;
    font-size: 16px;
    line-height: 19px;
    background-color: var(--toast-header);
    box-shadow: 0 2px 3px 0 var(--toast-box-shadow);
    border-radius: 5px 5px 0 0;
    padding: 12px 20px;

    .icon {
      margin-right: 5px;

      img {
        width: 18px;
        height: 18px;
      }
    }

    .dismiss {
      width: 16px;
      height: 16px;
      opacity: .5;
      transition: opacity .2s;
      margin-left: auto;
      cursor: pointer;
      font-size: 12px;
      padding: 1px;

      &:hover {
        opacity: 1;
      }
    }
  }

  .contents {
    display: flex;
    border-radius: 0 0 5px 5px;
    text-align: center;
    justify-content: flex-end;
    flex-direction: column;
    padding: 10px 10px 0;

    .inner {
      color: var(--text-normal);
      font-size: 14px;
      line-height: 16px;
      background-color: var(--toast-contents);
      border: 2px solid var(--toast-border);
      border-radius: 5px;
      padding: 10px 6px;
      margin: 0 0 6px;
    }
  }

  .buttons {
    box-sizing: border-box;
    flex-wrap: wrap;
    display: flex;
    width: 100%;
    padding: 10px;

    button {
      box-sizing: border-box;
      min-width: calc(50% - 10px);
      padding: 1.5%;
      margin: 1.5% 3px;
      flex: 1;

      &[class*='lookGhost-'] {
        opacity: .8;
        transition: background-color .17s ease, color .17s ease, opacity .17s ease, -webkit-transform .17s ease;

        &:hover {
          opacity: 1;
        }
      }
    }
  }

  .contents + .buttons {
    padding-top: 0;
  }

  &.leaving {
    animation: slide-out .7s ease-out;
  }
}

/*========= Light Theme =========*/
.theme-light .powercord-toast {
  border: 1px solid hsla(0, 0%, 74.9%, .3);
}

/*========= Header Types =========*/
$types: (
  info: #7289da,
  warning: #faa61a,
  danger: #f04747,
  success: #43b581
);

.powercord-toast {
  @each $type, $color in $types {
    &[data-toast-type='#{$type}'] {
      .icon {
        color: $color;
      }
    }
  }
}

/*========== Animations ==========*/
@keyframes shake {
  10%, 90% {
    transform: translate3d(1px, 0, 0);
  }

  20%, 80% {
    transform: translate3d(2px, 0, 0);
  }

  30%, 50%, 70% {
    transform: translate3d(-4px, 0, 0);
  }

  40%, 60% {
    transform: translate3d(4px, 0, 0);
  }
}

@keyframes slide-in {
  from {
    margin-right: -500px;
    opacity: 0;
  }
}

@keyframes slide-out {
  to {
    margin-right: -500px;
    opacity: 0;
  }
}
